package vn.lumi.smarthome.network;

import android.content.Context;

public class AckSchedule extends HCMsg{

	//constants
	private static int LENGTH = 5;
	
	//position of byte
	public static final int CmdIdPos = 0;
	public static final int MsgIdPos = 1;
	public static final int UserIdPos=2;
	public static final int ScheduleIdPos=3;
	public static final int NewConfigPos=4;
	
	//attributes
	private int Schedule_id = 0;
	private int user_id = 0;
	private int newConfigVersion = 0;
	
	public AckSchedule() {
		super(NetMessage.CMD_HC_ACK_SCHEDULE, 0, LENGTH);
		// TODO Auto-generated constructor stub
	}

	@Override
	public void parseMessage(byte[] input, int length) {
		// TODO Auto-generated method stub
		if(isCorrectFormat(input, length) == true){
			Msg_id = Byte2Unsigned(input[AckSchedule.MsgIdPos]);
			Schedule_id = Byte2Unsigned(input[AckSchedule.ScheduleIdPos]);
			// Hieu them vao
			user_id = Byte2Unsigned(input[AckSchedule.UserIdPos]);
			newConfigVersion = Byte2Unsigned(input[AckSchedule.NewConfigPos]);
			//end
			System.out.println("AckScene: Msg_id = " + Msg_id + " User_id = " +this.user_id + " Schedule_id = " + Schedule_id + " new config version = " + this.newConfigVersion);
		}
	}
	
	public int getScheduleId(){
		return Schedule_id;
	}
	public int getConfigVersion(){
		return this.newConfigVersion;
	}
	
	public int getUserId(){
		return this.user_id;
	}
	@Override
	public void doWhenReceived(Context context) {
		// TODO Auto-generated method stub
		//send Msg to UI
	}



}
